import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
  {
    path: '/',
    name: 'layout',
      redirect: '/Banner',
    component:  () => import('@/Layout/index.vue'),
    children: [
        {
            path: '/Banner',
            name: 'Banner',
            component:  () => import('@/views/Banner/index.vue'),
        },
        {
            path: '/Banner/Save/:id?',
            name: 'BannerSave',
            component:  () => import('@/views/Banner/Save.vue'),
        },
        {
            path: '/ProductCategory',
            name: 'ProductCategory',
            component:  () => import('@/views/Category/index.vue'),
        },
        {
            path: '/ProductCategory/Save/:id?',
            name: 'ProductCategorySave',
            component:  () => import('@/views/Category/Save.vue'),
        },
        {
            path: '/ProductList',
            name: 'ProductList',
            component:  () => import('@/views/ProductList/index.vue'),
        },
        {
            path: '/ProductList/Save/:id?',
            name: 'ProductListSave',
            component:  () => import('@/views/ProductList/Save.vue'),
        },
        {
            path: '/ProductOrder',
            name: 'ProductOrder',
            component:  () => import('@/views/ProductOrder/index.vue'),
        },
        {
            path: '/ProductOrder/Save/:id?',
            name: 'ProductOrderSave',
            component:  () => import('@/views/ProductOrder/Detail.vue'),
        },
        {
            path: '/Member',
            name: 'Member',
            component:  () => import('@/views/Member/index.vue'),
        },
        {
            path: '/Member/Save/:id?',
            name: 'MemberSave',
            component:  () => import('@/views/Member/Save.vue'),
        },
        {
            path: '/Member/Address/:id?',
            name: 'MemberAddress',
            component:  () => import('@/views/Member/Address.vue'),
        },
        {
            path: '/Coupon',
            name: 'Coupon',
            component:  () => import('@/views/Coupon/index.vue'),
        },
        {
            path: '/Coupon/Save/:id?',
            name: 'CouponSave',
            component:  () => import('@/views/Coupon/Save.vue'),
        },
        {
            name: 'role',
            path: '/role',
            component:  () => import('@/views/role/index.vue'),
        },
        {
            name: 'roleSave',
            path: '/role/Save/:id?',
            component:  () => import('@/views/role/Save.vue'),
        },
        {
            name: 'user',
            path: '/user',
            component:  () => import('@/views/user/index.vue'),
        },
        {
            name: 'userSave',
            path: '/user/Save/:id?',
            component:  () => import('@/views/user/Save.vue'),
        },
    ]
  },
    {
        path: '/login',
        name: 'login',
        component:  () => import('@/views/Login.vue'),
    }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
